(function(){
	var vm=new Vue({
		el:'#wrapper',
		data:{
            article: 1 //相关内容类型，1：疾病大全，2：病案分享，3：指南共识
		},
		components: {
			'clinic-head': clinicHead,
			'clinic-right': clinicRight,
            'clinic-foot': clinicFoot,
            'clinic-page':clinicPage
		},
		methods:{
			openIntroduce:function(){
				var openBox=document.getElementById("openBox");
				openBox.style.display="block";
			},
			closeIntroduce:function(){
				var openBox=document.getElementById("openBox");
				openBox.style.display="none";
			},
			moveVideo:function(){
				var relevantVideoLeft = document.getElementById("relevantVideoLeft");relevantVideoLeft
				var relevantVideoRight = document.getElementById("relevantVideoRight");
				var oUl = document.getElementById("relevantVideoContent");
				var aLi = oUl.getElementsByTagName("li");
				var now = -3 * (aLi[0].offsetWidth + 20);
				oUl.style.width = aLi.length * (aLi[0].offsetWidth + 20) + 'px';
				relevantVideoRight.onclick = function () {
					var n = Math.floor((aLi.length * (aLi[0].offsetWidth + 20) + oUl.offsetLeft) / aLi[0].offsetWidth);
					
					if (n <= 3) {
						move(oUl, 'left', 0);
					}
					else {
						move(oUl, 'left', oUl.offsetLeft + now);
					}
				}
				relevantVideoLeft.onclick = function () {
					var now1 = -Math.floor((aLi.length / 3)) * 3 * (aLi[0].offsetWidth + 20);

					if (oUl.offsetLeft >= 0) {
						move(oUl, 'left', now1);
					}
					else {
						move(oUl, 'left', oUl.offsetLeft - now);
					}
				}
				function getStyle(obj, name) {
					if (obj.currentStyle) {
						return obj.currentStyle[name];
					}
					else {
						return getComputedStyle(obj, false)[name];
					}
				}
				function move(obj, attr, iTarget) {
					clearInterval(obj.timer)
					obj.timer = setInterval(function () {
						var cur = 0;
						if (attr == 'opacity') {
							cur = Math.round(parseFloat(getStyle(obj, attr)) * 100);
						}
						else {
							cur = parseInt(getStyle(obj, attr));
						}
						var speed = (iTarget - cur) / 6;
						speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
						if (iTarget == cur) {
							clearInterval(obj.timer);
						}
						else if (attr == 'opacity') {
							obj.style.filter = 'alpha(opacity:' + (cur + speed) + ')';
							obj.style.opacity = (cur + speed) / 100;
						}
						else {
							obj.style[attr] = cur + speed + 'px';
						}
					}, 30);
				}
			}
		},
		mounted:function(){
			this.moveVideo();
		}
	})
})(Vue)